﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using Demo.Model;

using Pampa.CRUD;
using Pampa.CRUD.Configuration;
using Pampa.CRUD.Core;

public partial class EntityEdit : AbstractPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string entityName = Request["entityName"];
        string entityID = Request["entityID"];

        if (entityID == null)
        {
            this.entityEdit.Entity = EntityManager.Create(entityName);
        }
        else
        {
            this.entityEdit.Entity = EntityManager.Load(entityName, int.Parse(entityID));
        }

        this.btnAccept.OnSuccess = "Entity.entitySaved('" + entityName + "')";
        this.btnCancel.MethodName = "Entity.list('" + entityName + "')";
    }
}
